﻿namespace Lg.Core.Form.Types
{
    public class Phone : BaseType, IType
    {
        /// <summary>
        /// 支持固定电话
        /// </summary>
        public bool SupportTelephone { get; set; }
        public void Verify()
        {
            if (this.IsRender)
            {
                if (Required)
                {
                    Validate.Required(Value, $"字段:{Title},不可为空！");
                }
                Validate.Phone(Value!);
            }
            
        }

        public void GetSaveDbValue(Dictionary<string, dynamic> formData, string inputValue)
        {
            formData.Add(Name, inputValue);
        }
    }
}
